package com.ruoyi.web.controller.biz;

import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.BizCustomer;
import com.ruoyi.system.domain.BizCustomerRecruit;
import com.ruoyi.system.service.BizCustomerRecruitService;
import com.ruoyi.system.service.BizCustomerService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/biz/customerRecruit")
public class BizCustomerRecruitController extends BaseController {

    @Resource
    private BizCustomerRecruitService customerRecruitService;

    @Anonymous
    @GetMapping("/list")
    public TableDataInfo list(BizCustomerRecruit bizCustomerRecruit) {
        startPage();
        List<BizCustomerRecruit> customerRecruitList = customerRecruitService.selectCustomerRecruitList(bizCustomerRecruit);
        return getDataTable(customerRecruitList);
    }

    @Anonymous
    @GetMapping(value = "/queryById")
    public AjaxResult queryById(@RequestParam("id") Long id) {
        return success(customerRecruitService.selectCustomerRecruitById(id));
    }

    @Anonymous
    @PostMapping("/save")
    public AjaxResult save(@RequestBody BizCustomerRecruit bizCustomerRecruit) {
        return toAjax(customerRecruitService.insertCustomerRecruit(bizCustomerRecruit));
    }

}
